package filesystem;
import java.util.Date;


public abstract class FSElement 
{
	private String name = null;
	private String owner = null;
	private Date created = null; 
	private Date lastModified = null;
	protected int size = 0;
	private Directory parent = null;
	private SizeCalculator sc = null;
		
	
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
	public void setOwner(String owner) {
		this.owner = owner;
	}
	public String getOwner() {
		return owner;
	}
	public void setCreated(Date created) {
		this.created = created;
	}
	public Date getCreated() {
		return created;
	}
	public void setLastModified(Date lastModified) {
		this.lastModified = lastModified;
	}
	public Date getLastModified() {
		return lastModified;
	}
	public void setSize(int size) {
		this.size = size;
	}
	
	public int getSize() 
	{		
		return sc.CalculateSize(this);
	}
	protected void setParent(Directory parent) {
		this.parent = parent;
		if (parent != null)
			parent.addChild(this);
	}
	public Directory getParent() {
		return parent;
	}
	
	public boolean isLeaf()
	{
		return true;
	}
	
	abstract public String getInfo(String prefix);		
	
	public void setSizeCalculator(SizeCalculator sc) {
		this.sc = sc;
	}
	public SizeCalculator getSc() {
		return sc;
	}
	
	public String toString()
	{
		return name;
	}

}
